import { createBrowserRouter, RouterProvider } from "react-router-dom";
import Root from "./Root";
import ErrorPage from "./ErrorPage";
import Contact from "./Contact";
import { loader as contactLoader } from "./Contact/loader";

const router = createBrowserRouter([
	{
		path: "/",
		element: <Root />,
		errorElement: <ErrorPage />,
		loader: contactLoader,
		children: [
			{
				path: "contacts/:contactId",
				element: <Contact />
			}
		]
	}
]);

export default <RouterProvider router={router} />;
